package ai.people.netmon.msgsearch.controller;

import ai.people.netmon.framework.domain.searchmsg.bean.EsUserTotalFields;
import ai.people.netmon.framework.domain.searchmsg.request.KeyAccountSearchRequest;
import ai.people.netmon.framework.model.response.PageResponse;
import ai.people.netmon.framework.model.response.Result;
import ai.people.netmon.framework.utils.ResultUtil;
import ai.people.netmon.msgsearch.service.KeyAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhenglin
 * @date 2022/8/1
 */
@RestController
@RequestMapping("/keyAccount")
public class KeyAccountController {

    @Autowired
    KeyAccountService keyAccountService;

    /**
     * 得到
     *
     * @param request 请求
     * @return {@link Result}<{@link ?}>
     */
    @PostMapping("/search")
    public Result<PageResponse<EsUserTotalFields>> search(@Validated @RequestBody KeyAccountSearchRequest request){
        PageResponse<EsUserTotalFields>  result = keyAccountService.search(request);
        return ResultUtil.success(result);
    }

}
